﻿using System.Collections.Generic;
using System.Linq;
using Diploma.Models.IRepositories;

namespace Diploma.Models.Repositories
{
    internal class PlaningsRepository : IPlaningsRepository
    {
        private readonly DiplomaEntities dataContext;

        public PlaningsRepository(DiplomaEntities dataContext)
        {
            this.dataContext = dataContext;
        }

        public IEnumerable<PlaningType> GetAllPlaningTypes()
        {
            return dataContext.PlaningTypes;
        }

        public PlaningType GetPlaningType(int id)
        {
            return dataContext.PlaningTypes.Where(pt => pt.PlaningTypeId == id).FirstOrDefault();
        }
    }
}